home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 July: Mac OS SDK / Dev.CD Jul 97 SDK2.toast / Development Kits (Disc 2) / ScriptX / Documentation / Code Examples from Docs / langguid / chap_08 / xmpl_03.sx < prev   
Encoding:
Text File  |  1996-05-21  |  542 b   |  26 lines  |  [TEXT/R*ch]

  1. --<<<
  2. -- Kaleida Labs, Inc.
  3. -- Field Guide to the ScriptX Language
  4. -- chapter 8, example 3
  5.  
  6. -- creating a new class of exceptions
  7. global tooOld, abuela
  8.  
  9. class PeopleException (Exception) end
  10. tooOld := new PeopleException name: "tooOld" \
  11.                 format: "No one lives to be %* years old."
  12.  
  13. class People ()
  14.     instance variables _age
  15.     instance methods
  16.         method ageGetter self ->
  17.             return self._age
  18.         method ageSetter self val -> (
  19.             if val > 115 then report tooOld val
  20.             else self._age := val
  21.         )
  22. end
  23.  
  24. abuela := new People
  25. abuela.age := 122
  26. -->>>